home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ham Radio 2000
/
Ham Radio 2000.iso
/
ham2000
/
packet
/
terminal
/
top_152
/
src152.exe
/
rar
/
TOPAUS.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1995-05-16
|
29KB
|
966 lines
{┌─────────────────────────────────────────────────────────────────────────┐}
{│ │}
{│ T. O. P. │}
{│ │}
{│ (T)he (O)ther (P)acket │}
{│ │}
{│ T O P A U S . P A S │}
{│ │}
{│ │}
{│ │}
{│ Routinen für diverse Ausgaben. (Bildschirm, Morsezeichen ... usw.) │}
{│ Desweiteren Speicherung der Backsrolltexte. │}
{│ │}
{└─────────────────────────────────────────────────────────────────────────┘}
Procedure Scroll (* Art : str2; Aufruf,Y1,Y2 : Byte *); (* Video-Ram scrollen *)
Var i : Byte;
Begin
if not ((Aufruf = 0) and BackScroll(show)) then
begin
if Art = Up then { Aufwärts scrollen }
begin
if ScrollVor or not NowFenster or ((Y2 = maxZ) and (show > 0)) then
move(Bild^[Y1*160+1],Bild^[((Y1-1)*160)+1],(Y2-Y1)*160) else
begin
for i := 0 to 2 do { nur links und rechts vom Fenster wird gescrollt }
begin
move(Bild^[(Y1+i)*160+1],Bild^[((Y1-1+i)*160)+1],(XL-1)*2);
move(Bild^[(Y1+i)*160+1+2*(XR-1)],Bild^[((Y1-1+i)*160)+1+2*(XR-1)],(81-XR)*2);
end; { Unter dem Fenster werden wieder alle Zeilen komplett gescrollt }
if Y2-Y1-3 > 0 then
move(Bild^[(Y1+3)*160+1],Bild^[((Y1+2)*160)+1],(Y2-Y1-3)*160);
end; { Abwärts scrollen }
end else move(Bild^[((Y1-1)*160)+1],Bild^[(Y1)*160+1],(Y2-Y1)*160);
ScrollVor := false;
end;
End;
Procedure _aus (* Attr,Kanal : Byte; Zeile : String *);
Var i,X2M : Byte;
ch : Char;
Aktuell : Boolean;
Hstr : String[80];
Begin
Aktuell := (Kanal = show) and not BackScroll(Kanal);
with K[Kanal]^ do
Begin
While pos(^J,Zeile) > 0 do delete(Zeile,pos(^J,Zeile),1);
Hstr := '';
X2M := X2;
if Save and not RX_Save then Write_SFile(Kanal,Zeile);
if Drucker then Write_Drucker(Kanal,Zeile);
Zeile := Line_Convert(Kanal,2,Zeile);
if (pos(^G,Zeile) > 0) and
not(Ignore or RX_Save or EigFlag or RemFlag or FileFlag or Mo.MonActive) and
TNC_ReadOut and CtrlBeep then Beep(G^.CTRL_G_Freq,G^.CTRL_G_Time);
if Rx_Beep and Aktuell and Klingel then
begin
LockIntFlag(0);
Beep(G^.RxPiepFreq,G^.RxPiepTime);
LockIntFlag(1);
end;
for i := 1 to ord(Zeile[0]) do
begin
ch := Zeile[i];
if ch = #0 then ch := #255;
if RxLRet then
begin
if (X2 > 80) and (ch = M1) then ch := ^J;
Write_Notstr(Kanal,M1);
Write_Notstr(Kanal,chr(ChAttr(Attr)));
if Aktuell then
begin
if Hstr > '' then
if BiosOut then WriteBios(Kanal,X2M,QEnd,Attr,0,Hstr)
else WritePage(Kanal,X2M,QEnd,Attr,0,Hstr);
Scroll(Up,0,QBeg,QEnd);
WriteRam(1,QEnd,Attr,0,G^.Leer);
end;
if (NeueZeilen < N999) then inc(NeueZeilen);
Hstr := '';
X2M := 1;
X2 := 1;
end;
RxLRet := false;
if ch = M1 then RxLRet := true else
if ch <> ^J then
begin
Write_Notstr(Kanal,ch);
Hstr := Hstr + ch;
inc(X2);
if X2 > 80 then RxLRet := true;
end;
end; (* for i := ... *)
Write_Notiz(Kanal);
if (Hstr > '') and Aktuell then
if BiosOut then WriteBios(Kanal,X2M,QEnd,Attr,0,Hstr)
else WritePage(Kanal,X2M,QEnd,Attr,0,Hstr);
End;
End;
Procedure M_aus (* Attr : Byte; Zeile : String *);
Var i,X2M : Byte;
ch : Char;
Hstr : String[80];
Flag,
Output,
Aktuell : Boolean;
Begin
Aktuell := show = 0;
Output := ((K[show]^.UnStat < maxZ) or Aktuell) and not Backscroll(0);
with K[0]^ do
Begin
if Save then Write_SFile(0,Zeile);
if Drucker then Write_Drucker(0,Zeile);
Zeile := Line_Convert(0,2,Zeile);
Hstr := '';
X2M := X2;
Flag := false;
for i := 1 to ord(Zeile[0]) do
begin
ch := Zeile[i];
if ch = #0 then ch := #255;
if RxLRet then
begin
if (X2 > 80) and ((ch = M1) or (ch = ^J)) then Flag := true;
Write_Notstr(0,M1);
Write_Notstr(0,chr(ChAttr(Attr)));
if Output then
begin
if Hstr > '' then WritePage(0,X2M,maxZ,Attr,1,Hstr);
if Aktuell then Scroll(Up,0,UnStat+1,maxZ)
else Scroll(Up,1,K[show]^.UnStat+1,maxZ);
WriteRam(1,maxZ,Attr,1,G^.Leer);
end;
if (NeueZeilen < N999) then inc(NeueZeilen);
Hstr := '';
X2 := 1;
X2M := 1;
end;
RxLRet := false;
if (ch = ^J) or (ch = M1) then
begin
if not Flag then RxLRet := true;
if ZeigeRet and (ch = M1) then
begin
RxLRet := true;
Write_Notstr(0,^J);
Hstr := Hstr + ^J;
inc(X2);
end;
end else if not Flag then
begin
Write_Notstr(0,ch);
Hstr := Hstr + ch;
inc(X2);
if X2 > 80 then RxLRet := true;
end;
Flag := false;
end;
Write_Notiz(0);
if (Hstr > '') and Output then WritePage(0,X2M,maxZ,Attr,1,Hstr);
end;
End;
Procedure Write_Notiz; (* Kanal : Integer *)
var l : Byte;
i : Word;
i1 : Integer;
Hstr : string;
Begin
with K[Kanal]^ do
begin
l := ord(NZeile[0]);
if use_EMS then EMS_Seite_einblenden(Kanal,Scr);
if use_Vdisk then Open_Scroll(Kanal);
if NotPos + l > (maxNotCh-1) then
begin
i1 := NotPos + l - (maxNotCh-1);
if use_Vdisk then
begin
Hstr := copy(NZeile,1,(maxNotCh-1)-NotPos);
BlockWrite(ScrollFile,Hstr[1],length(Hstr),i);
delete(NZeile,1,(maxNotCh-1)-NotPos);
Seek(ScrollFile,Pos_im_Scr);
BlockWrite(ScrollFile,NZeile[1],length(NZeile),i);
end else
if use_XMS then
begin
Data_to_XMS(@NZeile[1],XMS_Handle,Pos_im_Scr+NotPos,(maxNotCh-1)-NotPos);
Data_to_XMS(@NZeile[(maxNotCh-1)-NotPos+1],XMS_Handle,Pos_im_Scr,i1);
NotPos := i1;
end else
begin
move(NZeile[1],NotCh[Kanal]^[NotPos],(maxNotCh-1)-NotPos);
move(NZeile[(maxNotCh-1)-NotPos+1],NotCh[Kanal]^[0],i1);
NotPos := i1;
end;
end else
begin
if use_Vdisk then
begin
BlockWrite(ScrollFile,NZeile[1],l,i);
end else if use_XMS then
begin
Data_to_XMS(@NZeile[1],XMS_Handle,Pos_im_Scr+NotPos,l);
NotPos := NotPos + l;
end else
begin
move(NZeile[1],NotCh[Kanal]^[NotPos],l);
NotPos := NotPos + l;
end;
end;
if use_Vdisk then Close_Scroll(Kanal);
NZeile := '';
end; { with }
End;
Procedure Write_Notstr (* Kanal : Byte; ch : char *);
Begin
with K[Kanal]^ do
begin
if length(NZeile) >= 255 then Write_Notiz(Kanal);
NZeile := NZeile + ch;
end;
End;
Procedure Write_BoxStr (* Kanal,Art : Byte *);
Var Zstr : String[40];
Ach : Char;
i,lp : Byte;
Result : Word;
Nr : LongInt;
RubHeader,
RunHeader,
Checks,
Lists : Boolean;
Begin
Checks := false;
Lists := false;
RubHeader := false;
RunHeader := false;
lp := 1;
FillChar(G^.MlStr,SizeOf(G^.MlStr),0);
Zstr := '';
Ach := 'U';
with K[Kanal]^ do
begin
if Art = 0 then
begin
if SCon[2] then (* BBOX *)
begin
i := pos(') ',BoxStr);
if (i > 0) and (i < 8) and (pos('(',BoxStr) <> 1) then BoxStr[i] := B1;
i := pos('R ',BoxStr);
if (i > 0) and (i < 8) and (str_int(copy(BoxStr,1,i-1)) > 0) then
begin
BoxStr[i] := B1;
BoxStr[i+1] := 'r';
end;
i := pos('F ',BoxStr);
if (i > 0) and (i < 8) and (str_int(copy(BoxStr,1,i-1)) > 0) then
begin
BoxStr[i] := B1;
BoxStr[i+1] := 'f';
end;
i := pos('E ',BoxStr);
if (i > 0) and (i < 8) and (str_int(copy(BoxStr,1,i-1)) > 0) then
begin
BoxStr[i] := B1;
BoxStr[i+1] := 'e';
end;
end;
for i := 1 to maxBlBox do
begin
G^.MlStr[i] := ParmStr(i,B1,BoxStr);
if length(G^.MlStr[i]) > 0 then lp := i;
end;
Nr := LongInt(str_int(G^.MlStr[1]));
if Nr > 0 then (* Hier war die erste Sequenz eine Nummer *)
begin
if SCon[1] or SCon[2] or SCon[14] then (* DBOX oder BBOX oder TBOX im Connect *)
begin
if (G^.MlStr[3] = '>') and (copy(G^.MlStr[5],3,1) = Pkt ) and
(copy(G^.MlStr[5],6,1) = Pkt ) then
begin
Checks := true;
Ach := 'C';
Rubrik := copy(G^.MlStr[4],1,8);
i := pos(Pkt ,Rubrik);
if i > 0 then Rubrik := copy(Rubrik,1,i-1);
Rubrik := EFillStr(8,B1,Rubrik);
end else if (copy(G^.MlStr[3],3,1) = Pkt ) and (copy(G^.MlStr[3],6,1) = Pkt ) and
(str_int(G^.MlStr[5]) > 0) then
begin
Lists := true;
Ach := 'L';
end;
end;
if SCon[3] then (* FBOX *)
begin
if (pos('P',BoxStr) in [7..10]) or (pos('B',BoxStr) in [7..10]) and
(LongInt(str_int(G^.MlStr[1])) > 0) then
begin
Lists := true;
Rubrik := ConstStr(B1,8);
Ach := 'L';
end;
end;
if SCon[4] then (* WBOX *)
begin
if (pos('@',BoxStr) = 22) and
(LongInt(str_int(G^.MlStr[2])) > 0) then
begin
Checks := true;
Ach := 'C';
Rubrik := EFillStr(8,B1,copy(BoxStr,14,8));
end;
end;
if SCon[5] then (* EBOX *) (* Die EBOX ist nur eine lokale Box *)
begin
Zstr := UpCaseStr(G^.MlStr[8]);
if (Word(str_int(G^.MlStr[2])) > 0) and
(Word(str_int(G^.MlStr[7])) > 0) and
((Zstr = 'T') or (Zstr = 'D')) then
begin
Lists := true;
Rubrik := ConstStr(B1,8);
Ach := 'L';
end;
end;
end else
begin
if SCon[1] or SCon[2] then (* DBox + BBox *)
begin
if ((pos(G^.BinEL,BoxStr) = 1) or (pos(G^.TxtEL,BoxStr) = 1)) and
(LongInt(str_int(G^.MlStr[3])) > 0) then
begin
BoxStr := EFillStr(45,B1,RunRub + G^.MlStr[2]) +
SFillStr(8,B1,G^.MlStr[3]) + B1 + OneByte + B1 +
copy(G^.MlStr[5],1,6) +
copy(G^.MlStr[5],9,2) + B1 +
copy(G^.MlStr[6],1,5) + B1 +
G^.MlStr[1];
Ach := 'R';
Lists := true;
end else
if ((pos(G^.BinEL,BoxStr) = 1) or (pos(G^.TxtEL,BoxStr) = 1)) and
(LongInt(str_int(G^.MlStr[2])) > 0) then
begin
BoxStr := EFillStr(45,B1,G^.MlStr[5]) +
SFillStr(8,B1,G^.MlStr[2]) + B1 + OneByte + B1 +
EFillStr(15,B1,G^.MlStr[4]) +
G^.MlStr[1];
Ach := 'R';
Lists := true;
end else
if (pos(G^.DirEL,BoxStr) = 1) and
(copy(G^.MlStr[2],length(G^.MlStr[2]),1) = BS ) and
(pos(Pkt ,G^.MlStr[4]) = 3) and
(pos(DP,G^.MlStr[5]) = 3) then
begin
BoxStr := EFillStr(74,B1,RunRub + G^.MlStr[2]) + CutStr(BoxStr);
Ach := 'V';
Lists := true;
end else
if (copy(BoxStr,length(G^.MlStr[1]),1) = BS ) and
(pos('Datei',G^.MlStr[3]) = 1) and
(G^.MlStr[5] = OneByte) and
(pos('Unterverzeichnis',G^.MlStr[7]) = 1) then
begin
BoxStr := EFillStr(40,B1,RunRub + CutStr(BoxStr)) +
SFillStr(3,B1,int_str(str_int(G^.MlStr[2]))) + B1 + Files + B1 +
SFillStr(8,B1,G^.MlStr[4]) + B1 + OneByte +
SFillStr(4,B1,int_str(str_int(G^.MlStr[6]))) + B1 + DIRs;
Ach := 'V';
Lists := true;
end else
if (copy(BoxStr,3,1) = Pkt ) and
(copy(BoxStr,6,1) = Pkt ) and
(copy(BoxStr,11,2) = ' ') and
(pos(':\',G^.MlStr[2]) = 2) and
(pos(B1,G^.MlStr[2]) = 0) then
begin
BoxStr := RestStr(BoxStr);
Ach := 'V';
Lists := true;
end else
if pos(G^.RunElFile,BoxStr) = 1 then
begin
{ Dateien im Unterverzeichnis: D:\DISKTOOL\*.* }
RunRub := G^.MlStr[lp];
While (RunRub[0] > #0) and (RunRub[Ord(RunRub[0])] <> BS )
do RunRub[0] := Chr(Ord(RunRub[0])-1);
Rubrik := ConstStr(B1,8);
RubHeader := true;
RunHeader := true;
end else
if pos(G^.RunElDir,BoxStr) = 1 then
begin
{ Unterverzeichnisse von: D:\*.* }
RunRub := G^.MlStr[lp];
While (RunRub[0] > #0) and (RunRub[Ord(RunRub[0])] <> BS )
do RunRub[0] := Chr(Ord(RunRub[0])-1);
Rubrik := ConstStr(B1,8);
RubHeader := true;
RunHeader := true;
end else
if pos(G^.RunElTree,BoxStr) = 1 then
begin
{ Verzeichnisbaum fuer EL-Laufwerk/EL-Pfad: D:\EL\ }
RunRub := G^.MlStr[lp];
Rubrik := ConstStr(B1,8);
RubHeader := true;
RunHeader := true;
end;
end;
if SCon[1] then (* DBox *)
begin
if (pos(G^.InfoDieBox,BoxStr) = 1) or (pos(G^.UserDieBox,BoxStr) = 1) or
(pos(G^.RubrikStr,BoxStr) = 1) then
begin
RubHeader := true;
Rubrik := EFillStr(8,B1,CutStr(RestStr(BoxStr)));
end;
end;
{ Inhaltsverzeichnis fuer DF8MT @DB0GV: }
{ Inhaltsverzeichnis fuer COMPUTER/IBM: }
if SCon[2] then (* BBOX *)
begin
if pos(G^.InfoBayBox,BoxStr) = 1 then
begin
RubHeader := true;
Zstr := G^.MlStr[3];
While pos('/',Zstr) > 0 do delete(Zstr,1,pos('/',Zstr));
While pos(DP,Zstr) > 0 do delete(Zstr,pos(DP ,Zstr),1);
Rubrik := EFillStr(8,B1,Zstr);
end;
end;
if SCon[5] then (* EBOX *)
begin
if (pos(G^.EzFileStr,BoxStr) = 1) or (pos(G^.EzMsgStr,BoxStr) = 1) then
begin
RubHeader := true;
Rubrik := ConstStr(B1,8);
end;
end;
if SCon[14] then (* TBOX *)
begin
Zstr := RestStr(BoxStr);
if (pos(G^.InfoTnc3Box,BoxStr) = 1) and (Zstr[length(Zstr)] = DP) then
begin
delete(Zstr,length(Zstr),1);
RubHeader := true;
Rubrik := EFillStr(8,B1,Zstr);
end;
end;
if RubHeader then
begin
if RunHeader
then BoxStr := GPkt + B1 + Call + B1 + GPkt + B1 + copy(Datum,1,8) + B1 +
copy(Uhrzeit,1,5) + B1 + GPkt + B1 + RunRub
else BoxStr := GPkt + B1 + Call + B1 + GPkt + B1 + copy(Datum,1,8) + B1 +
copy(Uhrzeit,1,5) + B1 + GPkt + B1 + G^.RubrikStr + Rubrik;
KillEndBlanks(BoxStr);
BoxStr := BoxStr + B1;
if Ord(BoxStr[0]) > 80 then BoxStr[0] := Chr(80);
BoxStr := EFillStr(79,GPkt,BoxStr) + B2;
BoxStr[81] := Chr(Attrib[20]);
Ach := 'R';
end;
end;
end;
if (Art = 1) or Checks or Lists or RubHeader then
begin
if length(BoxStr) < 80 then
BoxStr := EFillStr(80,B1,BoxStr) + Chr(Attrib[18]);
BoxStr := BoxStr + Ach + Chr(SysArt) + Rubrik;
Seek(DBox,FSize);
BlockWrite(DBox,BoxStr[1],1,Result);
FSize := FilePos(DBox);
inc(NewChkLst);
end;
FillChar(BoxStr,SizeOf(BoxStr),0);
end;
End;
Procedure Write_RxFile (* Kanal : Byte; Zeile : String *);
Var i,i1 : Integer;
Free : LongInt;
Result : Word;
Hstr : String[80];
VC : Char;
Bstr : String;
Begin
with K[Kanal]^ do
Begin
case RX_Bin of
1 : begin (* normales Textfile *)
if RemoteSave and (MldOk in [16,17]) then
begin
CloseRxFile(Kanal,0);
RX_Save := false;
RX_Bin := 0;
RemoteSave := false;
S_Aus(Kanal,3,M1 + InfoZeile(117) + B1 +
int_Str(RX_TextZn) + B1 + InfoZeile(118)+ M1);
if MsgToMe then
begin
MsgToMe := false;
Eig_Mail_Zeile := '';
Check_Eig_Mail(1,maxLink);
if Eig_Mail_Zeile > '' then
begin
InfoOut(show,0,1,InfoZeile(153) + Eig_Mail_Zeile);
If Klingel then Triller;
end;
end;
Ignore := false;
SetzeFlags(Kanal);
Send_Prompt(Kanal,FF);
end else
if RemoteSave and (MldOk = 10) then
begin
CloseRxFile(Kanal,0);
RX_Save := false;
RX_Bin := 0;
RemoteSave := false;
Ignore := false;
if EraseBin(RXFile) = 0
then S_Aus(Kanal,3,M1 + Star + InfoZeile(41) + M1);
SetzeFlags(Kanal);
Send_Prompt(Kanal,FF);
end else
begin
RX_Count := RX_Count + length(Zeile);
Zeile := Line_Convert(Kanal,2,Zeile);
Bstr := '';
for i := 1 to length(Zeile) do
Begin
VC := Zeile[i];
case VC of
^I : Bstr := Bstr + VC;
M1 : begin
Bstr := Bstr + #13 + #10;
inc(RX_TextZn);
end;
#1..#31
: Bstr := Bstr + '^' + Chr(Ord(VC)+64);
#0 :;
#127:;
else Bstr := Bstr + VC;
end;
if (length(Bstr) > 250) or (i = length(Zeile)) then
begin
BlockWrite(RXFile,Bstr[1],length(Bstr),Result);
Bstr := '';
end;
End;
FileInfo(Kanal,0,0,RX_Count,0,0);
end;
end;
2 : begin (* normales Binärfile-Empfangen *)
BlockWrite(RXFile,Zeile[1],length(Zeile),Result);
RX_Count := RX_Count + length(Zeile);
FileInfo(Kanal,0,0,RX_Count,0,0);
end;
5 : begin (* Automatischer Binärfile-Empfang *)
if MldOk in [6,10] then
begin
if MldOk = 10 then
begin
FiResult := CloseBin(RxFile);
FiResult := EraseBin(RxFile);
S_PAC(Kanal,NU,false,InfoZeile(41) + M1);
Send_Prompt(Kanal,FF);
end else CloseRxFile(Kanal,1);
RX_Bin := 0;
RX_Save := false;
Remotesave := false;
Ignore := false;
AutoBinOn := AutoBin;
SetzeFlags(Kanal);
end else
begin
i1 := length(Zeile);
if (RX_Count + i1) > RX_Laenge then i1 := Byte(RX_Laenge - RX_Count);
BlockWrite(RXFile,Zeile[1],i1,Result);
RX_CRC := Compute_CRC(RX_CRC,copy(Zeile,1,Result));
RX_Count := RX_Count + i1;
FileInfo(Kanal,0,RX_Laenge,RX_Count,0,0);
if RX_Count >= RX_Laenge then
begin
CloseRxFile(Kanal,0);
Result := Word(RX_CRC);
RX_Save := false;
RX_Bin := 0;
AutoBinOn := AutoBin;
Ignore := false;
SetzeFlags(Kanal);
Hstr := Time_Differenz(RX_Time,Uhrzeit);
Zeile := FName_aus_FVar(RxFile);
While pos(BS,Zeile) > 0 do delete(Zeile,1,pos(BS,Zeile));
Zeile := M1 + B1 + InfoZeile(103) + B1 +
EFillStr(14,B1,Zeile) + InfoZeile(100) +
int_str(Result) + B2 + LRK + Hex(Result,4) + B1 +
BdStr + FileBaud(Hstr,int_str(RX_Count)) + B2 +
LRK + Hstr + RRK + M1;
if (RX_Soll_CRC > 0) and (Result <> RX_Soll_CRC)
then Zeile := Zeile + B1 + InfoZeile(113) + ^G + M1;
Zeile := Zeile + M1;
if Remotesave and (SysArt = 0) and not FileSend then
begin
S_PAC(Kanal,NU,false,Zeile);
Send_Prompt(Kanal,FF);
end;
Remotesave := false;
if RxComp then MeldeCompZ := ''
else MeldeZeile := '';
G^.DZeile := Zeile;
WeFlag := true;
if Klingel and BLTON then Beep(900,100);
end;
end;
end;
end; (* case RX_Bin of ... *)
End; (* with ... do *)
End;
Procedure Write_SFile (* Kanal : Byte; Zeile : String *);
Var i : Byte;
Result : Word;
VC : Char;
Flag : Boolean;
Hstr : String;
Begin
Flag := K[Kanal]^.EigFlag or K[Kanal]^.FileFlag or K[Kanal]^.RemFlag;
Zeile := Line_Convert(Kanal,2,Zeile);
Hstr := '';
for i := 1 to length(Zeile) do
Begin
VC := Zeile[i];
if Flag and (Kanal > 0) and K[Kanal]^.SvLRet then Hstr := Hstr + EchoCh + B1;
K[Kanal]^.SvLRet := false;
case VC of
^I : Hstr := Hstr + VC;
^J : if Kanal = 0 then Hstr := Hstr + #13 + #10;
M1 : begin
if (Kanal = 0) and ZeigeRET then Hstr := Hstr + '^' + Chr(Ord(^J)+64);
Hstr := Hstr + #13 + #10;
K[Kanal]^.SvLRet := true;
end;
#0 :;
#127:;
#1..#31
: Hstr := Hstr + '^' + Chr(Ord(VC)+64)
else Hstr := Hstr + VC;
end;
if (length(Hstr) > 250) or (i = length(Zeile)) then
begin
BlockWrite(K[Kanal]^.SFile,Hstr[1],length(Hstr),Result);
Hstr := '';
end;
End;
End;
Procedure Write_SplFile (* Kanal : Byte; Zeile : String *);
Type FPtr = Array [1..500] of Char;
Var i : Byte;
Result : Word;
Count : Word;
ch : Char;
Feld : ^FPtr;
Begin
with K[Kanal]^ do
begin
GetMem(Feld,SizeOf(Feld^));
FillChar(Feld^,SizeOf(Feld^),0);
Count := 0;
for i := 1 to length(Zeile) do
Begin
ch := Zeile[i];
case ch of
^J : ;
M1 : begin
inc(Count);
Feld^[Count] := #13;
inc(Count);
Feld^[Count] := #10;
end;
else begin
inc(Count);
Feld^[Count] := ch;
if not Spl_COR_ERR then
begin
inc(Spl_gCount);
inc(Spl_tCount);
end;
end;
end;
End;
BlockWrite(SplFile,Feld^,Count,Result);
FreeMem(Feld,SizeOf(Feld^));
if not Spl_COR_ERR then
FileInfo(Kanal,2,Spl_gLaenge,Spl_gCount,Spl_tLaenge,Spl_tCount);
end;
End;
Procedure WriteBuffer (* Kanal : Byte; Zeile : String *);
var Result : Word;
Begin
with K[Kanal]^ do if BufExists then
begin
Seek(BufFile,FileSize(BufFile));
BlockWrite(BufFile,Zeile[1],length(Zeile),Result);
end;
End;
Procedure SendBuffer (* Kanal : Byte *);
Var Result : Word;
Zeile : String;
BufTill : LongInt;
BufStr : String[10];
Begin
with K[Kanal]^ do if BufExists then
begin
Seek(BufFile,BufPos);
BlockRead(BufFile,Zeile[1],PacLen,Result);
BufPos := FilePos(BufFile);
BufStr := '';
BufTill := FileSize(BufFile) - BufPos;
if BufTill > 9999 then
begin
BufTill := BufTill div 1024;
BufStr := 'K';
end;
if BufTill > 9999 then
begin
BufTill := BufTill div 1024;
BufStr := 'M';
end;
BufStr := int_str(BufTill) + BufStr;
StatusOut(Kanal,6,4,Attrib[7],SFillStr(5,B1,BufStr));
if Result > 0 then
begin
Zeile[0] := chr(Result);
TxRxTNC(Kanal,0,Zeile);
end else EraseBufferFile(Kanal);
end;
End;
Procedure Morse (* Kanal : Byte; Zeile : str80 *);
var i,i1,i2 : Byte;
VC : char;
Begin
for i := 1 to length(Zeile) do
begin
VC := UpCase(Zeile[i]);
i1 := 1;
LockIntFlag(0);
While (i1 < maxMorAnz) and (Mchs[i1].Ze <> VC) do inc(i1);
if Mchs[i1].Ze = VC then
begin
for i2 := 1 to length(Mchs[i1].Co) do
begin
case Mchs[i1].Co[i2] of
Pkt : Beep(G^.Tonhoehe,MPause);
'-' : Beep(G^.Tonhoehe,3 * MPause);
end;
Verzoegern(MPause);
end;
Verzoegern(2 * MPause);
end else
if VC = B1 then Verzoegern(7 * MPause) else
begin
Sound((G^.Tonhoehe div 3) * 2);
Verzoegern(MPause);
NoSound;
Verzoegern(MPause);
end;
LockIntFlag(1);
end;
End;
Function Compress (* Zeile : String) : String *);
Var Hstr : String;
t : Word;
s : Word;
i : Byte;
a : Integer;
b,c : Byte;
ch : Char;
long : Boolean;
Begin
FillChar(Hstr,SizeOf(Hstr),0);
a := 7;
b := 1;
long := false;
i := 0;
While (i < length(Zeile)) and not long do
begin
inc(i);
t := HTable[ord(Zeile[i])].Tab;
s := $8000;
C := 0;
While (C < HTable[ord(Zeile[i])].Len) and not long do
begin
inc(C);
if t and s = s then Hstr[b] := Chr(ord(Hstr[b]) + 1 shl a);
s := s shr 1;
dec(a);
if a < 0 then
begin
a := 7;
inc(b);
if b > 254 then long := true;
end;
end;
Hstr[0] := chr(b);
end;
if (length(Hstr) > length(Zeile)) or long then
begin
Hstr := Zeile[0] + Zeile;
ch := #255;
end else ch := Chr(length(Hstr));
Compress := ch + Hstr;
End;
Function DeCompress (* Zeile : String) : String *);
Var Hstr : String;
b,i,l : Byte;
a : Integer;
t,t2 : Word;
Bit : LongInt;
ch : Char;
Begin
ch := Zeile[1];
delete(Zeile,1,1);
if ch = #255 then delete(Zeile,1,1);
if (ch < #255) and (Zeile[0] > #0) then
begin
Hstr := '';
l := 0;
Bit := 0;
for i := 1 to length(Zeile) do
begin
Bit := (Bit shl 8) or ord(Zeile[i]);
l := Byte(l + 8);
a := 0;
Repeat
b := HTable[a].Len;
if l >= b then
begin
t := HTable[a].Tab;
t2 := Word(Bit shr (l-b)) shl (16-b);
if t = t2 then
begin
Hstr := Hstr + chr(a);
l := l - b;
a := -1;
end;
end;
inc(a);
Until (a > 257) or (l < 3);
end;
end else Hstr := Zeile;
DeCompress := Hstr;
End;